#if defined( DEBUG ) | defined( _DEBUG )

#include "Assert.h"
#include <cstdio>
#include <cstdarg>
#include <windows.h>

#include "Logger.h"

#define VA_LIST_MACRO( NAME, BUFFER ) { va_list ap; va_start( ap, NAME ); wvsprintf( BUFFER, NAME, ap ); va_end( ap ); }

void Assert::CustomAssert( bool condition, int lineNumber, const char* fileName )
{
	if ( condition )
	{
		return;
	}	
		
	//char buff[ 256 ];
	//VA_LIST_MACRO( description, buff );

	LOG( "Assertion Failed! - File = %s, Line = %d \n", fileName, lineNumber );
	//OutputDebugString( "Assertion Failed! - File = %s, Line = %d \n", fileName, lineNumber );
	//exit( 0 );
	DebugBreak();
}

void Assert::CustomAssert( bool condition, char* description, ... )
{
	if ( condition )
	{
		return;
	}	
		
	char buff[ 256 ];
	VA_LIST_MACRO( description, buff );
	LOG( buff ); //description,  ); //buff );
	OutputDebugString( buff );
	//exit( 0 );
	DebugBreak();
}

void Assert::CustomNullAssert( void* pointer, int lineNumber, const char* fileName )
{
	if ( pointer != NULL )
	{
		return;
	}	
		
	//char buff[ 256 ];
	//VA_LIST_MACRO( description, buff );

	LOG( "Assertion Failed! - File = %s, Line = %d \n", fileName, lineNumber );
	//OutputDebugString( "Assertion Failed! - File = %s, Line = %d \n", fileName, lineNumber );
	//exit( 0 );
	DebugBreak();
}

void Assert::CustomNullAssert( void* pointer, char* description, ... )
{
	if ( pointer != NULL )
	{
		return;
	}	
		
	char buff[ 256 ];
	VA_LIST_MACRO( description, buff );
	LOG( buff ); //description,  ); //buff );
	OutputDebugString( buff );
	//exit( 0 );
	DebugBreak();
}

#endif

